<div id='feeds_<%= order_item.id%>'>
  <%#*<div class="arrow">◆</div>%>
  <div id='feeds_<%= order_item.id %>_nav_bar' class="feeds_nav_bar">
    <%= link_to_function '所有进展', '', :class => 'item h', :id => "show_all_feeds_#{order_item.id}" %>
    <%= link_to_function '派工安装', '', :class => 'item', :id => "show_related_installation_feeds_#{order_item.id}" %>
    <%= link_to_function '售后服务', '', :class => 'item', :id => "show_related_after_service_feeds_#{order_item.id}" %>
    <%= link_to_function '厂家订做', '', :class => 'item', :id => "show_related_order_made_feeds_#{order_item.id}" %>
    <%= link_to_function '文字视图', '', :title => '切换到文字视图',:class => "view #{current_user.feed_view_type.text? ? 'hv':''}", :id => "feeds_#{order_item.id}_text_view" %>
    <b class="s">|</b>
    <%= link_to_function '表格视图', '', :title => '切换到表格视图',:class => "view #{current_user.feed_view_type.table? ? 'hv':''}", :id => "feeds_#{order_item.id}_table_view" %>
    <script type="text/javascript" charset="utf-8">
      $('#show_all_feeds_<%= order_item.id %>').click(function() {
        $('#feeds_<%= order_item.id %>_nav_bar .item').removeClass('h');
        $(this).addClass('h');
        $('#feeds_<%= order_item.id %> .feeds .feed').show('fast');
      });
      $('#show_related_installation_feeds_<%= order_item.id %>').click(function() {
        $('#feeds_<%= order_item.id %>_nav_bar .item').removeClass('h');
        $(this).addClass('h');
        $('#feeds_<%= order_item.id %> .feeds .feed').hide();
        $('#feeds_<%= order_item.id %> .feeds .related_installation').show('fast');
      });

      $('#show_related_after_service_feeds_<%= order_item.id %>').click(function() {
        $('#feeds_<%= order_item.id %>_nav_bar .item').removeClass('h');
        $(this).addClass('h');
        $('#feeds_<%= order_item.id %> .feeds .feed').hide();
        $('#feeds_<%= order_item.id %> .feeds .related_after_service').show('fast');
      });
      $('#show_related_order_made_feeds_<%= order_item.id %>').click(function() {
        $('#feeds_<%= order_item.id %>_nav_bar .item').removeClass('h');
        $(this).addClass('h');
        $('#feeds_<%= order_item.id %> .feeds .feed').hide();
        $('#feeds_<%= order_item.id %> .feeds .related_order_made').show('fast');
      });
      $('#feeds_<%= order_item.id %>_text_view').click(function() {
        $('#feeds_<%= order_item.id %> .table_view').hide();
        $('#feeds_<%= order_item.id %> .text_view').show('fast');
        $('#feeds_<%= order_item.id %> .view').removeClass('hv');
        $(this).addClass('hv');
        $.post(
          "<%= update_feed_view_type_user_url(current_user)  %>",{
            _method: 'PUT',
            feed_view_type: 'text'
          }
        );
      });
      $('#feeds_<%= order_item.id %>_table_view').click(function() {
        $('#feeds_<%= order_item.id %> .text_view').hide();
        $('#feeds_<%= order_item.id %> .table_view').show('fast');
        $('#feeds_<%= order_item.id %> .view').removeClass('hv');
        $(this).addClass('hv');
        $.post(
          "<%= update_feed_view_type_user_url(current_user)  %>",{
            _method: 'PUT',
            feed_view_type: 'table'
          }
        );
      });
    </script>    
  </div>  
  <div class='feed first'></div>
  <div class='feeds'>    
    <% order_item.feeds.each_with_index do |feed,index| %>
    <div id="feed_<%= feed.id %>" class='feed <%= feed.related_type %> <%= feed.related_html_id %> <%= can_edit ? 'feed_move' : '' %>'>
      <div>
        <div class="last_logo <%= order_item.feed == feed ? '':'hidden' %>">
          <div title="最新进展"></div>
        </div>
        <div class='type'>
          <% if can_edit %>
          <%= link_to_function '移动','', :id => "move_feed_#{feed.id}",:class => :move_feed, :title => '上下移动换位置' %>
          <script>
            //jquery sortable参数说明http://hi.baidu.com/siphp/blog/item/9af4470c5cef7421e82488ac.html
            $('a#move_feed_<%= feed.id %>').mouseover(function() {
              $('#feeds_<%= order_item.id%> .feeds').sortable({
                disabled: false,
                stop: function() {
                  $.ajax({
                      url: "<%= reset_feeds_position_order_url %>?" + $("#feeds_<%= order_item.id%> .feeds").sortable("serialize")
                  });
                }
              });
            });
            
           $('a#move_feed_<%= feed.id %>').mouseout(function() {
              $('#feeds_<%= order_item.id%> .feeds').sortable({ disabled: true });
            });
          </script>
          <% end %>
          <span class="news <%= feed.code %>">
            <%= index + 1 %>. <%= t(feed.code) %>
          </span>
        </div>
        <div class='content'>
          <span class="text_view <%= current_user.feed_view_type.text? ? '' : 'hidden' %>">
          <%= raw feed.short_desc %>
          </span>
          <span class="table_view <%= current_user.feed_view_type.table? ? '' : 'hidden' %>">
            <%= render :partial => "orders/feeds/table/#{feed.code}.html", :locals => {:feed => feed} %>
          </span>
        </div>
      </div>
      <% if feed.remark.present? %>
      <div class='remark text_view <%= current_user.feed_view_type.text? ? '' : 'hidden' %>'>
        <b>备注：</b><%= feed.remark %>
      </div>
      <% end %>
      <div id='recorder_<%= feed.id %>' class='recorder'>
        <%= render :partial => 'orders/feeds/recorder_in_index.html', :locals => { :feed => feed, :can_edit => can_edit } %>
      </div>
      <div id="edit_feed_<%= feed.id %>" class="edit_feed"><!--feed的修改容器-->

      </div>
      <div id='tasks_<%= feed.id %>' class='tasks <%= Task.where(:feed_id => feed).mine.any? ? 'full_tasks' : '' %>'>
        <%= render :partial => 'orders/tasks/index.html', :locals => {:feed => feed} %>
      </div>
      <div class='clear'></div>
    </div>    
    <script type="text/javascript" charset="utf-8">
      $('#feed_<%= feed.id %>').mouseover(function() { 
        $('div.<%= feed.related_html_id %>').addClass('related_h');
      });
      $('#feed_<%= feed.id %>').mouseout(function() { 
        $('div.<%= feed.related_html_id %>').removeClass('related_h');
      });
    </script>
    <% end %>  
  </div>
  <div id="new_feed_<%= order_item.id %>" class="feed last">    
    <%= render :partial => 'orders/feeds/new.html', :locals => { :order_item => order_item} %>
  </div>  
  <div class="feed last_o"></div>
</div>